package com.permission.entity;

import com.permission.config.CodeConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 响应相关的实体类
 *
 * @author my
 * @date 2020/7/11 11:39
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Response implements Serializable {
    private static final Map<Integer, String> config;
    private Integer code=400;
    private String msg="获取失败";
    private Object data;
    static {
        config=new HashMap<>();
        config.put(CodeConfig.SUCCESS,"success");
        config.put(CodeConfig.LOGIN_FILED,"登录失败");
        config.put(CodeConfig.ERROR,"error");
        config.put(CodeConfig.SYSTEM_ERROR,"系统错误");
        config.put(CodeConfig.RESOURCE_NOT_FOUND,"页面未找到");
        config.put(CodeConfig.ACCESS_DENIED,"访问被拒绝");
        config.put(CodeConfig.ERROR_CODE,"验证码错误");
    }
    public String getMsg(){
        return config.get(code);
    }
}
